package com.briup.product_source.web.controller;

import com.briup.product_source.bean.ManagerAnimalExt;
import com.briup.product_source.service.AnimalService;
import com.briup.product_source.util.Response;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author lining
 * @Date 2023/6/26
 */
@RequestMapping("/animal")
@RestController
public class AnimalController {
    @Autowired
    private AnimalService service;

    @GetMapping("/query")
    public Response findByPage(String pageNum,String pageSize,String aHealthy,String aGender){
        PageInfo<List<ManagerAnimalExt>> page =
                service.findByPage(Integer.parseInt(pageNum),
                        Integer.parseInt(pageSize), aHealthy, aGender);
        return Response.success(page);
    }
    //请求参数名和方法名不同 使用@PequestParam
    @GetMapping("/QRcode")
    public Response createQRcode(@RequestParam("animalId") String id){
        String path = service.createQRcodeByAnimalId(id);
        return Response.success();
    }
}
